package com.easy.tool.exception;

import com.sun.org.apache.xpath.internal.operations.Bool;
import org.apache.log4j.Logger;

/**
 * @author 高俊
 * @create 2022-04-2022/4/29-10:49
 */
public class ExceptionUtils {

    private static Logger logger = Logger.getLogger(ExceptionUtils.class);

    private static Boolean success = Boolean.TRUE;
    private static Boolean faild = Boolean.FALSE;

    /**
     * 判断是否是常规下划线格式字符串
     * @param str
     */
    public static boolean humpDecide(String str){
        if (nullDecide(str)){
            // 驼峰判断
            int humpIndex = str.indexOf("_");
            if (humpIndex == 0 || humpIndex == (str.length()-1)){
                logger.error("字符串无效，无法判定是常规下划线命名格式");
                return faild;
            }
            return success;
        }
        return faild;
    }


    public static boolean nullDecide(String str){
        if (null == str || str.equals("")){
            logger.error("字符串为NULL或为空，请输入有效值");
            return faild;
        }
        return success;
    }

}
